/*
 * Regenerate the Simplenote Tasks font with the following script.
 * Download the SVG task icons from the Simplecons repo
 *
 * // gen.js
 * const wfg = require('webfonts-generator');
 *
 * wfg({
 * 	files: [
 * 		'svg/task-unchecked.svg',
 * 		'svg/task-checked.svg'
 * 	],
 * 	dest: 'font/',
 * 	fontName: 'Simplenote Tasks',
 * 	types: ['woff'],
 * 	startCodepoint: 0xE000,
 * 	descent: 3, // needed to vertically align the tasks
 * }, () => {} );
 *
 * Once the script finishes copy the output here
 * ~$ node gen.js && cat font/Simplenote\ Tasks.woff | base64 | pbcopy
 */
@font-face {
  font-family: 'Simplenote Tasks';
  src: url('data:application/x-font-woff;charset=utf8-8;base64,d09GRgABAAAAAAQgAAsAAAAABrwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPwAAAFYpRjXwY21hcAAAAYQAAABPAAABfmBD5KlnbHlmAAAB1AAAAGAAAACINxFu0WhlYWQAAAI0AAAAMAAAADYV/A6waGhlYQAAAmQAAAAcAAAAJAAtABlobXR4AAACgAAAAAwAAAAMADAAAGxvY2EAAAKMAAAACAAAAAgAIABEbWF4cAAAApQAAAAeAAAAIAEPACJuYW1lAAACtAAAAT8AAAJzQ72hRHBvc3QAAAP0AAAAKgAAAEeHVaHleJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGQQYJzAwMrAwMDPIAAkmaE0NwMjAxsDAxMDKzMDVhCQ5prC4PCA4QEjg+j/v0CFogwglYwgOQC9ZgaRAHic7ZCxDYAwDATPiaFAjEFBwTBUzM8mydtmDF66k/7lysACdHEJB3swIrdWy72z5e4ceeOxvzaGTFjd001a+bOnz6+1+FNRnytoE7boCy0AeJxjYGJg+P+fQYxBiIGFQYSBwdxQVNnUXFmJTZZRRMya0cjMltFETZiPj48RCECEAB8fE4QFIhgYEPr5GUSB+tG0squbi5uLC8O1c7EwMrMzCiFM4GMFCjAxAAC/8AuCeJxjYGRgYADiawd0bOP5bb4ycDNIAEUYbidnHEXQ//8ziDEIAbkcDEwgUQA3/ArKeJxjYGRgYBD9/xdISjCAgBgDIwMqYAYAQWsCRQAAAAAAGAAAABgAAAAAAAAAIABEeJxjYGRgYGBmEGNgYgABEMkFhAwM/8F8BgAK7wEyAAB4nIWOy2rCQBSG/3grVWgLQrsrs2oXhXjZFFx2oeuquI860WiSCZNRELrvso/SJ3Dbt+ijFPqbHhCkYIZkvvNfDgFwgy94ODweGcIlXHD64zLpTrhCfhSuooFn4Rqu8SJcxxNehRto4o0bvMolFYUP4RKu8Clcpr4XrpC/hau4xY9wDfdeU7iOidcRbuDBex9FSRbr1DitxkG+zod6sYkDeyqfzhNt88ikquO3j1bhDHSqbeD0XE13Kt8uus6FKrQmUX2TOh3HRmXWrPTM+Uvnsl6rFYruz0yCESIkyBBDI4WB460wRoAca75Dzgts6AewZ9Pn/Alnyzuil9LpwEf739axMyjUQy8onDl7U+z4zbHlv3WpOoScQ2YMNyn0i/2HdMxjqGSFt6Iyo+5jWbQy9NDiCU/yPlPc9As0/naZAHicY2BiwA+YGZkYmRlZGPhKEouzdUvzkjNSk7NTU3jAXCiHgQEAqZ8KXQAA')
    format('woff2');
  unicode-range: U+E000-E001;
}

.note-detail-preview,
.note-content-plaintext.visible {
  padding: 0 calc((100% - 768px) / 2);
}

@media only screen and (max-width: 1400px) {
  .note-detail-preview,
  .note-content-plaintext.visible {
    padding: 0 10%;
  }
}

/* Monaco adds the dir='ltr' attribute to rtl languages.
   This does the opposite of what you think it should do.
*/
span[dir='ltr'] {
  float: right;
  margin-right: calc(100% - 768px);
}

.is-line-length-full {
  span[dir='ltr'] {
    margin-right: 20px;
  }
}

@media only screen and (max-width: 1400px) {
  span[dir='ltr'] {
    margin-right: 14%;
  }
}

.react-monaco-editor-container {
  .scrollbar.vertical {
    width: 10px !important;
    right: 0 !important;

    .slider {
      width: 10px !important;
    }
  }
}
// scrollbar search highlights
.decorationsOverviewRuler {
  width: 10px !important;
  right: -2px !important;
}

.is-line-length-full {
  .note-detail-preview,
  .note-content-plaintext.visible {
    padding: 0 25px;
  }
}

.note-content-editor-shell,
.note-detail-markdown {
  height: 100%;
  width: 100%;

  font-family: 'Simplenote Tasks', sans-serif;

  .slider {
    border-radius: 10px;
    border: 3px solid gray;
  }
  .search-decoration {
    background-color: rgba($studio-simplenote-blue-40, 0.6);
  }
}

/* Hide unwanted items in the context menu.
   This removes the first item (Change All Occurrences) and the last (Command Palette).
   The nth-child's remove Cut(7) and Copy(9) so we can add keybindings to them.
   We may need to adjust these rules if a Monaco update adds more default items,
   OR if we add/remove/reorder menu items sometime in the future :(
   See: https://github.com/microsoft/monaco-editor/issues/1280
*/
.monaco-menu .monaco-action-bar.vertical .action-item:first-child,
.monaco-menu .monaco-action-bar.vertical .action-item:nth-child(7),
.monaco-menu .monaco-action-bar.vertical .action-item:nth-child(9),
.monaco-menu .monaco-action-bar.vertical .action-item:nth-last-child(2),
.monaco-menu .monaco-action-bar.vertical .action-item:last-child {
  display: none !important;
}

/* Hide the suggestion popup
  See: https://github.com/microsoft/monaco-editor/issues/1681#issuecomment-580751164
*/
.monaco-editor .suggest-widget {
  display: none !important;
}

/* Safari requires that it be displayed absolute so that it takes the full height
*/
.note-content-editor-shell {
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
}

.search-results {
  position: fixed;
  left: 330px;
  right: 0;
  bottom: 0;
  height: 56px;
  line-height: 56px;
  z-index: 100;
  border-top: 1px solid $studio-gray-5;
  background-color: $studio-white;
  text-align: center;
  user-select: none;

  div {
    display: inline-block;
  }

  .search-results-next,
  .search-results-prev {
    float: right;
    padding: 0px 6px;
    width: 42px;
    height: 100%;

    svg {
      fill: $studio-simplenote-blue-50;
    }
  }
  .search-results-next {
    margin-right: 6px;
  }
  .search-results-prev svg {
    transform: scaleX(-1);
  }

  @media only screen and (max-width: $single-column) {
    left: 0;
  }
}

.note-detail-textarea .note-content-editor-shell.cursor-pointer div {
  cursor: pointer;
}

.note-content-plaintext {
  display: none;
  font-size: 16px;
  white-space: pre-wrap;

  &.visible {
    display: inherit;
  }
}

.theme-light {
  background-color: $studio-white;
  color: $studio-gray-60;

  .theme-color-bg {
    background-color: $studio-white;
  }
  .theme-color-bg-lighter {
    background-color: $studio-white;
  }
  .theme-color-fg {
    color: $studio-gray-80;
  }
  .theme-color-fg-dim {
    color: $studio-gray-50;
  }
  .theme-color-border {
    border-color: $studio-gray-5;
  }
  .search-field {
    border-color: $studio-gray-10;
  }
}

.theme-dark {
  background-color: $studio-gray-90;
  color: $studio-gray-20;

  .theme-color-bg {
    background-color: $studio-gray-90;
  }
  .theme-color-bg-lighter {
    background-color: $studio-gray-90;
  }
  .theme-color-fg {
    color: $studio-white;
  }
  .theme-color-fg-dim {
    color: $studio-gray-30;
  }
  .theme-color-border {
    border-color: $studio-gray-80;
  }

  ::-webkit-scrollbar-thumb {
    background-color: $studio-gray-80;
    border-color: $studio-gray-60;
  }
  ::-webkit-scrollbar-thumb:hover {
    background-color: $studio-gray-90;
  }
  ::-webkit-scrollbar-thumb:active {
    background-color: $studio-gray-50;
  }

  .button-borderless {
    color: $studio-simplenote-blue-30;

    &[disabled],
    &:disabled {
      svg[class^='icon-'] {
        fill: $studio-gray-60;
      }
    }
  }

  .icon-button,
  a {
    color: $studio-simplenote-blue-30;
  }

  input {
    color: $studio-white;
  }

  input,
  textarea {
    border-color: $studio-gray-70;
    background-color: transparent;
  }

  .transparent-input::placeholder,
  input::placeholder {
    color: $studio-gray-20;
  }

  .checkbox-control-base {
    border-color: $studio-gray-80;
  }

  .navigation-bar-item {
    button {
      color: $studio-white;
    }
    svg {
      fill: $studio-white;
    }
  }

  .navigation-bar-item.is-selected {
    button {
      color: $studio-simplenote-blue-30;
    }
    svg[class^='icon-'] {
      fill: $studio-simplenote-blue-30;
    }
  }
  .tag-list .tag-list-input.is-selected {
    color: $studio-simplenote-blue-30;
  }

  .tag-field {
    height: 56px;
    padding: 7px;
  }

  .tag-field input {
    background: transparent;

    &::placeholder {
      color: $studio-gray-20;
    }
  }

  .settings-group p {
    color: $studio-gray-5;
  }

  .tab-panels__tab-list {
    li {
      color: $studio-gray-50;

      &.is-active {
        color: $studio-simplenote-blue-30;
        border-bottom-color: $studio-simplenote-blue-30;
      }
    }

    li.button:active {
      background-color: $studio-simplenote-blue-30;
      color: $studio-white;
    }
  }

  .note-list-header {
    color: $studio-gray-30;
    background-color: rgba(50, 52, 54, 0.5);
  }

  .note-list-item {
    &.note-list-item-selected {
      background: $studio-gray-80;
    }

    .note-list-item-excerpt {
      color: $studio-gray-20;
    }
  }

  .note-list-item-pinner:hover,
  .note-list-item-pinner.note-list-item-pinned {
    color: $studio-simplenote-blue-20;
  }

  .note-detail-markdown {
    @import '../node_modules/highlight.js/scss/solarized-dark.scss';

    hr {
      border-color: $studio-gray-80;
    }

    blockquote {
      border-color: $studio-gray-80;
    }

    pre {
      border-color: $studio-gray-80;
    }

    table {
      th,
      td {
        border-color: $studio-gray-60;
      }
      tr:nth-child(2n) {
        background-color: $studio-gray-80;
      }
    }
  }

  .search-results {
    color: $studio-gray-10;
    border-color: $studio-gray-80;
    background-color: $studio-gray-90;

    button svg {
      fill: $studio-simplenote-blue-30;
    }
  }
}
